<template>
  <div class="store home">
    <div class="search">
      <x-address :title="title" :hide-district="true" value-text-align="right" @on-shadow-change="onShadowChange" :list="ChinaAddressV4Data"></x-address>
      <img class="img" src="@/assets/mendian1.png" />
      <input type="text" class="search-input" placeholder="请输入您要搜索的门店">
      <span class="serach-btn" @click="router({path: './storeSearch'})">搜索</span>
    </div>
    <swiper :options="bannerStore">
      <swiper-slide class="swiper-demo-img" v-for="(item, index) in 5" :key="index"><img src="@/assets/banner.png"></swiper-slide>
      <div class="swiper-pagination"  slot="pagination"></div>
    </swiper>
    <div class="store-list">
      <div class="item" @click="router({path: './storeDetails'})">
        <img src="@/assets/pic5.png" class="store-img" alt="">
        <p class="store-name">天赋系统儿童脑力拓天赋系统儿童脑力拓…</p>        
        <p class="store-address">
          <span>245m</span>
          <span class="address">广州市天河区太古汇商业广场古汇商业广场东…</span>
        </p>
        <div class="time">
          <img src="@/assets/mendian2.png" alt="">
          <span>教育是孩子最大值得关心教育是孩子最大值得关心...</span>
        </div>
      </div>
      <div class="item">
        <img src="@/assets/pic5.png" class="store-img" alt="">
        <p class="store-name">天赋系统儿童脑力拓天赋系统儿童脑力拓…</p>        
        <p class="store-address">
          <span>245m</span>
          <span class="address">广州市天河区太古汇商业广场古汇商业广场东…</span>
        </p>
        <div class="time">
          <img src="@/assets/mendian2.png" alt="">
          <span>教育是孩子最大值得关心教育是孩子最大值得关心...</span>
        </div>
      </div>
      <div class="item">
        <img src="@/assets/pic5.png" class="store-img" alt="">
        <p class="store-name">天赋系统儿童脑力拓天赋系统儿童脑力拓…</p>        
        <p class="store-address">
          <span>245m</span>
          <span class="address">广州市天河区太古汇商业广场古汇商业广场东…</span>
        </p>
        <div class="time">
          <img src="@/assets/mendian2.png" alt="">
          <span>教育是孩子最大值得关心教育是孩子最大值得关心...</span>
        </div>
      </div>
      <div class="item">
        <img src="@/assets/pic5.png" class="store-img" alt="">
        <p class="store-name">天赋系统儿童脑力拓天赋系统儿童脑力拓…</p>        
        <p class="store-address">
          <span>245m</span>
          <span class="address">广州市天河区太古汇商业广场古汇商业广场东…</span>
        </p>
        <div class="time">
          <img src="@/assets/mendian2.png" alt="">
          <span>教育是孩子最大值得关心教育是孩子最大值得关心...</span>
        </div>
      </div>
      <div class="item">
        <img src="@/assets/pic5.png" class="store-img" alt="">
        <p class="store-name">天赋系统儿童脑力拓天赋系统儿童脑力拓…</p>        
        <p class="store-address">
          <span>245m</span>
          <span class="address">广州市天河区太古汇商业广场古汇商业广场东…</span>
        </p>
        <div class="time">
          <img src="@/assets/mendian2.png" alt="">
          <span>教育是孩子最大值得关心教育是孩子最大值得关心...</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>

import { XAddress, ChinaAddressV4Data } from 'vux'
import { swiper, swiperSlide } from 'vue-awesome-swiper'
import 'swiper/dist/css/swiper.css'

export default {
  components: {
    swiper,
    swiperSlide,
    XAddress,
    ChinaAddressV4Data,  
  },
  data () {
    return {
      ChinaAddressV4Data: ChinaAddressV4Data,
      title: '省/市',
      count: 0,
      bannerStore: {
        loop: true,
        pagination: {
          el: '.swiper-pagination',
          clickable: true
        },
        autoplay: {
          delay: 3000,
          stopOnLastSlide: false,
          disableOnInteraction: true,
        },
      },
    }
  },
  created () {
  },
  methods: {
    router (path) {
      this.$router.push(path)
    },
    onShadowChange (ids, names) {
      this.count++
      if(this.count <= 1){
        return
      }
      this.title = (names[1] == '市辖区') ? names[0] : names[1]       
    },
  }
}
</script>
<style lang="stylus" scoped>
  .store
    max-width 100vw
    min-height 100vh
    padding-bottom 6rem
    box-sizing border-box
    .search
      height 4.4rem
      line-height 4.4rem
      background-color #fff
      position relative
      .img
        position absolute
        top 2.2rem
        width .7rem
        left 7.5rem
      .search-input
        position absolute
        width calc(100% - 15rem)
        right 5.5rem
        outline none
        height 4.4rem
      .serach-btn
        position absolute
        right 0
        width 5.5rem;
        line-height 4.4rem
        text-align center        
    .store-list
      padding 0 1.5rem
      overflow hidden
      .item
        width calc(50% - .75rem)
        float left
        margin-right 1.5rem
        margin-top 3rem
        &:nth-child(2n)
          margin-right 0
        .store-img
          width 100%
          border-radius .4rem
        .store-name
          font-size 1.7rem
          font-weight bold
          line-height 2.7rem
          color #333
          margin-top 1rem
          white-space nowrap
          text-overflow ellipsis
          overflow hidden
        .store-address
          font-size 1.2rem
          color #999
          font-weight 400
          overflow hidden
          line-height 1.4rem
          height 1.4rem
          margin-top 1rem
          span
            float left
          .address
            white-space nowrap
            text-overflow ellipsis
            overflow hidden
            float right
            width calc(100% - 6rem)
            padding-left 1.5rem
            border-left 1px solid #e6e6e6
        .time
          overflow hidden
          margin-top 1.5rem
          img
            width 1.6rem
            float left
          span
            color #43A047
            font-weight bold
            font-size 1.2rem
            float left
            margin-left .7rem
            line-height 1.6rem
            width calc(100% - 2.3rem)
            white-space nowrap
            overflow hidden
            text-overflow ellipsis
</style>